<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="../js/angular.min.js" ></script>
	</head>
	<!--定义模块名 -->
	<body ng-app="myapp" ng-controller="myctrol">
		<div>
			<input type="text" ng-model="name"/>
			<input type="button" value="清空" ng-click="clearVar()" />
		</div>
		<div>
			<p style="color:red" ng-bind="name"/></p>
		</div>
		<div>
			<p style="color:greenyellow">{{name}}</p>
		</div>
		<script type="text/javascript">
			//初始化模块
			var myapp=angular.module("myapp",[])
			//定义模块的控制器
			//注入$scope作用域对象
			myapp.controller("myctrol",["$scope",function($a){
				$a.name="666";
				$a.clearVar=function(){
					$a.name="";
				}
			}])
		</script>
	</body>
</html>
